package countGoodSubstrings;

import java.util.Arrays;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

public class Solution {
    public int countGoodSubstrings(String s) {
        // 如果有重复的字符串
        int ans = 0;
        for (int i = 0; i+2 < s.length(); i++) {
            if(check(s.substring(i,i+3))) ans++;
        }
        return ans;
    }
    private boolean check(String s) {
        Set<Character> set = new HashSet<>();
        set.add(s.charAt(0));
        set.add(s.charAt(1));
        set.add(s.charAt(2));
        return set.size() == 3;
    }
}
